﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;

namespace _0712502_0712504_DesignPatternGame
{
    public class AutomatedTank3 : AutomatedTank
    {
        public AutomatedTank3()
        {
            Initilize();
        }

        public void Initilize()
        {
            this.idTank = IDTank.idTank3;
            this.MaxHP = 300;
            this.Life = 1;
            this.CurrentHP = this.MaxHP;

            this._timeToChangeDirection = 250;
            this._timeToReload = 200;
            this._timeToShot = 0;
            this._timeShot = 15;
            this.Size = new Rectangle(0, 0, 54, 54);
            this.SizeOfRectInside = new Point(48, 48);
            this.SizeOfRectOutside = new Point(54, 54);
            
        }

        public override void DrawToScreen(Microsoft.Xna.Framework.GameTime gameTime, Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
        {
            this._bodyTank.DrawToScreen(gameTime, spriteBatch);
            this._turretTank.DrawToScreen(gameTime, spriteBatch);
            this._bulletManager.DrawToScreen(gameTime, spriteBatch);
            this.healthyBar.DrawToScreen(spriteBatch, CurrentHP, MaxHP);
        }

        public override VisibleGameEntity Clone()
        {
            AutomatedTank3 newObject = new AutomatedTank3();

            newObject.AddTurret((TankTurretModel)this.TurretTank.Clone());
            newObject.AddBody((TankBodyModel)this.BodyTank.Clone());
            newObject.AddEngine(this.EngineTank.Clone());

            newObject._bulletManager = new BulletManager();
            newObject.healthyBar = new HealthyBarDrawer(GameResourceContainer.ImageManager.enemyHealthyBar, 
                                                    new Point(54, 10), new Point(50, 8));
            return newObject;
        }        
    }
}
